//
//  Device.h
//  CloudWalletApp
//
//  Created by caoyong on 2020/8/11.
//  Copyright © 2020 董雷. All rights reserved.
//

#ifndef Device_h
#define Device_h

//手机屏幕的宽度
#define _width_                                                                \
MIN([UIScreen mainScreen].bounds.size.width,                                 \
[UIScreen mainScreen].bounds.size.height)

//手机屏幕的高度
#define _height_                                                               \
MAX([UIScreen mainScreen].bounds.size.height,                                \
[UIScreen mainScreen].bounds.size.width)

#define kScale(P)                ((P) * ([UIScreen mainScreen].bounds.size.width / 375.f))

//导航栏 iPhoneX的适配
#define HQYScreenHeight [UIScreen mainScreen].bounds.size.height
#define Is_Iphone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define Is_Iphone_X (IS_IOS_11 && IS_IPHONE && (MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 375 && MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 812))
#define NaviHeight (IS_IPHONE_XSeries ? 88 : 64)
#define TabbarHeight (Is_Iphone_X ? 83 : 49)
#define BottomHeight (Is_Iphone_X ? 34 : 0)
#define StatusBarHeight (Is_Iphone_X ? 44 : 20)
#define IS_IOS_11  ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.f)
#define IS_IPHONE_XSeries (IS_IOS_11 && IS_IPHONE && (MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 375 && MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 812))


//基于iphone6 的屏幕宽度比
#define KiPhone6BreadthWidth [UIScreen mainScreen].bounds.size.width/375
#define KiPhone6BreadthHeight [UIScreen mainScreen].bounds.size.height/667

// 向上缩放比例
#define KiUpPhone6BreadthWidth  (_width_ > 375 ? (_width_/375.0) : 1)
// 向上缩放比例
#define KiUpPhone6BreadthHeight  (_height_ > 667 ? (_height_/667.0) : 1)

//向上宽度适配
#define K_ScaleUpWidth(width) ((width)*KiUpPhone6BreadthWidth)
// 宽度适配
#define K_ScaleWidth(width) ( (width) * KiPhone6BreadthWidth)

//向上高度适配
#define K_ScaleUpHeight(height) ((height)*KiUpPhone6BreadthHeight)
// 高度适配
#define K_ScaleHeight(height) ((height)*KiPhone6BreadthHeight)
//获取当前系统版本
#define _ios12_0_ ([[UIDevice currentDevice].systemVersion floatValue] >= 12.0)
#define _ios11_0_ ([[UIDevice currentDevice].systemVersion floatValue] >= 11.0)
#define _ios10_0_ ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0)
#define _ios9_0_ ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0)
#define _ios8_0_ ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)

//设备型号
#define IS_IPAD          [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad
#define IS_IPHONE        [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone

//Iphone Type
#define IS_IPHONE_4     ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(320, 480), [[UIScreen mainScreen] currentMode].size) : NO)

#define IS_IPHONE_4S     ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define IS_IPHONE_5      ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define IS_IPHONE_6      ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
//1125x2001 6+是放大模式下的分辨率
#define IS_IPHONE_6_PLUS ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO) || ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen] currentMode].size) : NO)


#endif /* Device_h */
